package bg.tu.varna.pms.client.model;

import javax.swing.AbstractListModel;

import bg.tu.varna.pms.model.Contact;

/**
 * The Class UserSearchListModel.
 */
public class UserSearchListModel extends AbstractListModel<String> {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 7512679220521010262L;
	
	/** The contacts. */
	private final Contact[] contacts;
	
	/**
	 * Instantiates a new user search list model.
	 *
	 * @param contacts the contacts
	 */
	public UserSearchListModel(Contact[] contacts) {
		this.contacts = contacts;
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.ListModel#getSize()
	 */
	@Override
	public int getSize() {
		return contacts.length;
	}

	/* (non-Javadoc)
	 * @see javax.swing.ListModel#getElementAt(int)
	 */
	@Override
	public String getElementAt(int index) {
		return contacts[index].getNickname();
	}

}
